﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using PatientsManagement.Database;

namespace PatientsManagement.Users
{
    public partial class LinkDoctor : Form
    {
        int userID;
        public LinkDoctor(int userID,string forename,string surname)
        {
            InitializeComponent();
            FillTableWithDoctorsData();
            name.Text = forename + " " + surname;
            this.userID = userID;
        }

        private void FillTableWithDoctorsData()
        {
            dataView.DataSource = DoctorsData.GetShortenedDoctorsTable();
            int count = dataView.ColumnCount;
            for (int i = 0; i < dataView.ColumnCount; i++)
            {
                dataView.Columns[i].ReadOnly = true;
            }
        }

        internal void SaveChangesToDatabase()
        {
            DoctorsData.SaveDoctorLink((int)dataView.SelectedRows[0].Cells["ID"].Value, userID);
        }
    }
}
